import { merge } from "lodash-es";
import { mapStore } from "../../utils/store";
import { $http } from "../../boot/http";
export default merge(
  {
    namespaced: true,
    state: {},
    mutations: {},
    getters: {},
    actions: {
      // 获取资讯详情 
      async articleDetail({ dispatch }, params) {
        return dispatch(
          "toggleLoading",
          {
            key: "shop.coin_balance",
            loading: async () => {
              const { data } = await $http.get(
                "m/mfc/api/article/info",
                params
              );
              return data
            }
          },
          {
            root: true
          }
        );
      },
      // 获取区块数据
      async getfilInfo({ dispatch }, params) {
        return dispatch(
          "toggleLoading",
          {
            key: "shop.fil_info",
            loading: async () => {
              const { data } = await $http.get(
                "m/mfc/api/index/block",
                params
              );
              console.log(data)
              return data
            }
          },
          {
            root: true
          }
        );
      },
    }
  },
  // 获取资讯列表
  mapStore("articleList", {
    url: "m/mfc/api/article/index",
    options: {
      actionOptions: {
        commitType: "infinite"
      }
    },
    loadingKey: "mf.home.article_list"
  }),
  // 获取热门
  mapStore("articleHot", {
    url: "m/mfc/api/article/index",
    loadingKey: "xhhx.shop.article_hot"
  }),
);
